package cn.itcast.star.graph.comfyui.client.handler;

import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;

@Component
public class ComfyuiMessageHandler extends TextWebSocketHandler {

    @Override
    //连接成功服务器之后会调用
    public void afterConnectionEstablished(WebSocketSession session) throws Exception {
        System.out.println("=============连接成功");
    }

    @Override
    //接收到服务器推送的消息之后调用
    protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
        System.out.println("=============收到消息:"+message.getPayload());
    }
}
